package com.just.fun.design.guanchazhe;

import java.util.Vector;

public class Subject {
    private Vector<Observer> observers=new Vector<>();

    public void addObserver(Observer observer){
        observers.add(observer);
    }

    public void removeObserver(Observer observer){
        observers.remove(observer);
    }

    public void notifyMsg(String msg){
        for (Observer observer : observers) {
            observer.update(msg);
        }
    }
}
